home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7165 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Reading a line from a file
  5. Date: 14 Feb 96 20:35:13 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.824330113@rscernix>
  8. References: <4ft5hu$ns6@coranto.ucs.mun.ca>
  9. NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11.  
  12. In <4ft5hu$ns6@coranto.ucs.mun.ca> dpierce@morgan.ucs.mun.ca (David Pierce) writes:
  13.  
  14. >Anybody out there able to answer this question ?
  15.  
  16. Yeah, plenty of us.  Basically, anybody who has read a C book.
  17.  
  18. >I have a file with several lines of data in the following format:
  19. >
  20. >"123456789","Mr","David","Pierce","Memorial University of NF"
  21. >...
  22. >
  23. >I would like to read in the data between the double quotes. The
  24. >information between the quotes may or may not have whitespace
  25. >character's, but the info in quotes is only one field. ie.
  26. >Memorial University of NF is one field. So here is the million
  27. >dollar question. Is there a way to use fscanf, or some other C
  28. >function to read this information without having to read in the
  29. >complete line and parse out the information I want? I can write
  30. >a function to do this, but I wondered if there was already a way
  31. >for C to do this?
  32.  
  33. The answer is yes and the function is fscanf, of course.
  34. You can find the details in your C book (you're a programmer consultant,
  35. aren't you? :-)
  36.  
  37. >David Pierce
  38. >Programmer Consultant
  39.  ^^^^^^^^^^^^^^^^^^^^^
  40. Dan, waiting the promised $1,000,000 :-)
  41. --
  42. Dan Pop
  43. CERN, CN Division
  44. Email: danpop@mail.cern.ch 
  45. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  46.